<!DOCTYPE html>
<html lang="zh" dir="ltr" class="client-nojs">
<head>
<title>基础类型</title>
<meta charset="UTF-8">
<meta name="generator" content="MediaWiki 1.21.2">
<link rel="shortcut icon" href="../../../common/favicon.ico">
<link rel="stylesheet" href="../../../common/ext.css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" href="../../../common/site_modules.css">
<style>a:lang(ar),a:lang(ckb),a:lang(fa),a:lang(kk-arab),a:lang(mzn),a:lang(ps),a:lang(ur){text-decoration:none}#toc{display:none}.editsection{display:none}
/* cache key: mwiki1-mwiki_zh_:resourceloader:filter:minify-css:7:15cea3ec788a65b5187d4018eed543bf */</style>

<script src="../../../common/startup_scripts.js"></script>
<script>if(window.mw){
mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"cpp/language/types","wgTitle":"cpp/language/types","wgCurRevisionId":62663,"wgArticleId":902,"wgIsArticle":true,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":[],"wgBreakFrames":false,"wgPageContentLanguage":"zh","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"zh","wgMonthNames":["","1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"wgMonthNamesShort":["","1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"wgRelevantPageName":"cpp/language/types","wgUserVariant":"zh","wgRestrictionEdit":[],"wgRestrictionMove":[]});
}</script><script>if(window.mw){
mw.loader.implement("user.options",function(){mw.user.options.set({"ccmeonemails":0,"cols":80,"date":"default","diffonly":0,"disablemail":0,"disablesuggest":0,"editfont":"default","editondblclick":0,"editsection":0,"editsectiononrightclick":0,"enotifminoredits":0,"enotifrevealaddr":0,"enotifusertalkpages":1,"enotifwatchlistpages":0,"extendwatchlist":0,"externaldiff":0,"externaleditor":0,"fancysig":0,"forceeditsummary":0,"gender":"unknown","hideminor":0,"hidepatrolled":0,"imagesize":2,"justify":0,"math":1,"minordefault":0,"newpageshidepatrolled":0,"nocache":0,"noconvertlink":0,"norollbackdiff":0,"numberheadings":0,"previewonfirst":0,"previewontop":1,"quickbar":5,"rcdays":7,"rclimit":50,"rememberpassword":0,"rows":25,"searchlimit":20,"showhiddencats":0,"showjumplinks":1,"shownumberswatching":1,"showtoc":0,"showtoolbar":1,"skin":"cppreference2","stubthreshold":0,"thumbsize":2,"underline":2,"uselivepreview":0,"usenewrc":0,"watchcreations":0,"watchdefault":0,"watchdeletion":0,
"watchlistdays":3,"watchlisthideanons":0,"watchlisthidebots":0,"watchlisthideliu":0,"watchlisthideminor":0,"watchlisthideown":0,"watchlisthidepatrolled":0,"watchmoves":0,"wllimit":250,"variant":"zh","language":"zh","searchNs0":true,"searchNs1":false,"searchNs2":false,"searchNs3":false,"searchNs4":false,"searchNs5":false,"searchNs6":false,"searchNs7":false,"searchNs8":false,"searchNs9":false,"searchNs10":false,"searchNs11":false,"searchNs12":false,"searchNs13":false,"searchNs14":false,"searchNs15":false,"gadget-MathJax":1,"gadget-ColiruCompiler":1});;},{},{});mw.loader.implement("user.tokens",function(){mw.user.tokens.set({"editToken":"+\\","patrolToken":false,"watchToken":false});;},{},{});
/* cache key: mwiki1-mwiki_zh_:resourceloader:filter:minify-js:7:258d7cd6aa9aa67dee25e01fb6a9e505 */
}</script>
<script>if(window.mw){
mw.loader.load(["mediawiki.page.startup","mediawiki.legacy.wikibits","mediawiki.legacy.ajax"]);
}</script>
<style type="text/css">/*<![CDATA[*/
.source-cpp {line-height: normal;}
.source-cpp li, .source-cpp pre {
	line-height: normal; border: 0px none white;
}
/**
 * GeSHi Dynamically Generated Stylesheet
 * --------------------------------------
 * Dynamically generated stylesheet for cpp
 * CSS class: source-cpp, CSS id: 
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 * --------------------------------------
 */
.cpp.source-cpp .de1, .cpp.source-cpp .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;}
.cpp.source-cpp  {font-family:monospace;}
.cpp.source-cpp .imp {font-weight: bold; color: red;}
.cpp.source-cpp li, .cpp.source-cpp .li1 {font-weight: normal; vertical-align:top;}
.cpp.source-cpp .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}
.cpp.source-cpp .li2 {font-weight: bold; vertical-align:top;}
.cpp.source-cpp .kw1 {color: #0000dd;}
.cpp.source-cpp .kw2 {color: #0000ff;}
.cpp.source-cpp .kw3 {color: #0000dd;}
.cpp.source-cpp .kw4 {color: #0000ff;}
.cpp.source-cpp .co1 {color: #909090;}
.cpp.source-cpp .co2 {color: #339900;}
.cpp.source-cpp .coMULTI {color: #ff0000; font-style: italic;}
.cpp.source-cpp .es0 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es1 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es2 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es3 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es4 {color: #008000; font-weight: bold;}
.cpp.source-cpp .es5 {color: #008000; font-weight: bold;}
.cpp.source-cpp .br0 {color: #008000;}
.cpp.source-cpp .sy0 {color: #008000;}
.cpp.source-cpp .sy1 {color: #000080;}
.cpp.source-cpp .sy2 {color: #000040;}
.cpp.source-cpp .sy3 {color: #000040;}
.cpp.source-cpp .sy4 {color: #008080;}
.cpp.source-cpp .st0 {color: #008000;}
.cpp.source-cpp .nu0 {color: #000080;}
.cpp.source-cpp .nu6 {color: #000080;}
.cpp.source-cpp .nu8 {color: #000080;}
.cpp.source-cpp .nu12 {color: #000080;}
.cpp.source-cpp .nu16 {color:#000080;}
.cpp.source-cpp .nu17 {color:#000080;}
.cpp.source-cpp .nu18 {color:#000080;}
.cpp.source-cpp .nu19 {color:#000080;}
.cpp.source-cpp .ln-xtra, .cpp.source-cpp li.ln-xtra, .cpp.source-cpp div.ln-xtra {background-color: #ffc;}
.cpp.source-cpp span.xtra { display:block; }

/*]]>*/
</style><!--[if lt IE 7]><style type="text/css">body{behavior:url("/mwiki/skins/cppreference2/csshover.min.htc")}</style><![endif]--></head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-cpp_language_types skin-cppreference2 action-view cpp-navbar">
        <!-- header -->
        <!-- /header -->
        <!-- content -->
<div id="cpp-content-base">
            <div id="content">
                <a id="top"></a>
                <div id="mw-js-message" style="display:none;"></div>
                                <!-- firstHeading -->
<h1 id="firstHeading" class="firstHeading">基础类型</h1>
                <!-- /firstHeading -->
                <!-- bodyContent -->
                <div id="bodyContent">
                                        <!-- tagline -->
                    <div id="siteSub">来自cppreference.com</div>
                    <!-- /tagline -->
                                        <!-- subtitle -->
                    <div id="contentSub"><span class="subpages">&lt; <a href="../../cpp.html" title="cpp">cpp</a>‎ | <a href="../language.html" title="cpp/language">language</a></span></div>
                    <!-- /subtitle -->
                                                            <!-- bodycontent -->
                    <div id="mw-content-text" lang="zh" dir="ltr" class="mw-content-ltr"><div class="t-navbar" style=""><div class="t-navbar-sep"> </div><div class="t-navbar-head"><a href="../../cpp.html" title="cpp"> C++</a><div class="t-navbar-menu"><div><div><table class="t-nv-begin" cellpadding="0" style="line-height:1.1em;">
<tr class="t-nv"><td colspan="5"> <a href="../language.html" title="cpp/language">语言</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../header.html" title="cpp/header">标准库头文件</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../freestanding.html" title="cpp/freestanding"> 自立与有宿主实现</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../named_req.html" title="cpp/named req">具名要求</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../utility.html#.E8.AF.AD.E8.A8.80.E6.94.AF.E6.8C.81" title="cpp/utility">语言支持库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../concepts.html" title="cpp/concepts">概念库</a> <span class="t-mark-rev t-since-cxx20">(C++20)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../error.html" title="cpp/error">诊断库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../utility.html" title="cpp/utility">工具库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../string.html" title="cpp/string">字符串库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="https://zh.cppreference.com/w/cpp/container" title="cpp/container">容器库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../iterator.html" title="cpp/iterator">迭代器库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../ranges.html" title="cpp/ranges"> 范围库</a> <span class="t-mark-rev t-since-cxx20">(C++20)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../algorithm.html" title="cpp/algorithm">算法库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../numeric.html" title="cpp/numeric">数值库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../io.html" title="cpp/io">输入/输出库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../locale.html" title="cpp/locale">本地化库</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../regex.html" title="cpp/regex">正则表达式库</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../atomic.html" title="cpp/atomic">原子操作库</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../thread.html" title="cpp/thread">线程支持库</a> <span class="t-mark-rev t-since-cxx11">(C++11)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../filesystem.html" title="cpp/filesystem">文件系统库</a> <span class="t-mark-rev t-since-cxx17">(C++17)</span> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../experimental.html" title="cpp/experimental">技术规范</a> </td></tr>
</table></div><div></div></div></div></div><div class="t-navbar-sep"> </div><div class="t-navbar-head"><a href="../language.html" title="cpp/language">C++ 语言</a></div><div class="t-navbar-sep"> </div><div class="t-navbar-head"><a href="basic_concepts.html" title="cpp/language/basic concepts">基本概念</a><div class="t-navbar-menu"><div><div style="display:inline-block">
<div><table class="t-nv-begin" cellpadding="0" style="">
<tr class="t-nv"><td colspan="5"> <a href="../keywords.html" title="cpp/keyword"> 语言关键词</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="translation_phases.html" title="cpp/language/translation phases"> 翻译阶段</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="../comments.html" title="cpp/comment"> 注释</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="main_function.html" title="cpp/language/main function"> <code>main()</code> 函数</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="name.html" title="cpp/language/identifiers"> 名字和标识符</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="incomplete_type.html" title="cpp/language/type"> 类型</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <strong class="selflink"> 基础类型</strong> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="object.html" title="cpp/language/object"> 对象</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="scope.html" title="cpp/language/scope"> 作用域</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="lifetime.html" title="cpp/language/lifetime"> 对象生存期</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="storage_duration.html" title="cpp/language/storage duration"> 存储期与连接</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="definition.html" title="cpp/language/definition"> 定义和单一定义规则（ODR）</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="lookup.html" title="cpp/language/lookup"> 名字查找</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="qualified_lookup.html" title="cpp/language/qualified lookup"> 有限定名字查找</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="unqualified_lookup.html" title="cpp/language/unqualified lookup"> 无限定名字查找</a> </td></tr>
<tr class="t-nv"><td colspan="5"> <a href="as_if.html" title="cpp/language/as if"> “如同”规则</a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="ub.html" title="cpp/language/ub"> 未定义行为</a></td></tr>
<tr class="t-nv"><td colspan="5"> <a href="memory_model.html" title="cpp/language/memory model"> 内存模型</a> </td></tr>
</table></div>
</div><div></div></div></div></div><div class="t-navbar-sep"> </div></div>
<p><small>（类型系统概览见<a href="incomplete_type.html" title="cpp/language/type">类型</a>，以及参阅 C++ 库提供的<a href="../types.html" title="cpp/types">类型相关的工具列表</a>）</small>
</p>
<h3><span class="mw-headline" id="void_.E7.B1.BB.E5.9E.8B">void 类型</span></h3>
<dl><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">void</span></span></span> - 值为空集的类型。它是无法完成的<a href="incomplete_type.html#.E4.B8.8D.E5.AE.8C.E6.95.B4.E7.B1.BB.E5.9E.8B" title="cpp/language/type">不完整类型</a>（从而不允许存在 <code>void</code> 类型的对象）。不存在 <code>void</code> 的<a href="array.html" title="cpp/language/array">数组</a>，亦不存在到 <code>void</code> 的<a href="reference.html" title="cpp/language/reference">引用</a>。然而容许 <a href="pointer.html#void_.E7.9A.84.E6.8C.87.E9.92.88" title="cpp/language/pointer"><code>void</code> 的指针</a>和返回 <code>void</code> 类型的<a href="function.html" title="cpp/language/function">函数</a>（其他语言中的<i>过程</i>）。
</dd></dl>
<h3><span class="mw-headline" id="std::nullptr_t"><span class="t-lc"><a href="../types/nullptr_t.html" title="cpp/types/nullptr t">std::nullptr_t</a></span></span></h3>
<table class="t-dcl-begin"><tbody>
<tr class="t-dsc-header">
<td> <div>定义于头文件 <code><a href="../header/cstddef.html" title="cpp/header/cstddef">&lt;cstddef&gt;</a></code>
 </div></td>
<td></td>
<td></td>
</tr>
<tr class="t-dcl t-since-cxx11">
<td> <div><span class="mw-geshi cpp source-cpp"><span class="kw1">typedef</span> decltype<span class="br0">(</span>nullptr<span class="br0">)</span> nullptr_t<span class="sy4">;</span></span></div></td>
<td class="t-dcl-nopad">  </td>
<td> <span class="t-mark-rev t-since-cxx11">(C++11 起)</span> </td>
</tr>
<tr class="t-dcl-sep"><td></td><td></td><td></td></tr>
</tbody></table>
<p><span class="t-lc"><a href="../types/nullptr_t.html" title="cpp/types/nullptr t">std::nullptr_t</a></span> 是空指针字面量 <a href="nullptr.html" title="cpp/language/nullptr"><tt>nullptr</tt></a> 的类型。它是独立类型，既非指针类型，亦非成员指针类型。
</p>
<h3><span class="mw-headline" id=".E5.B8.83.E5.B0.94.E7.B1.BB.E5.9E.8B">布尔类型</span></h3>
<dl><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">bool</span></span></span> - 足以保有二个值 <a href="bool_literal.html" title="cpp/language/bool literal"><tt>true</tt></a> 或 <a href="bool_literal.html" title="cpp/language/bool literal"><tt>false</tt></a> 之一的类型。 <span class="t-c"><span class="mw-geshi cpp source-cpp">sizeof<span class="br0">(</span><span class="kw4">bool</span><span class="br0">)</span></span></span> 的值由实现定义，而且可以异于 1 。
</dd></dl>
<h3><span class="mw-headline" id=".E6.95.B4.E6.95.B0.E7.B1.BB.E5.9E.8B">整数类型</span></h3>
<dl><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">int</span></span></span> - 基本整数类型。若使用了下列任何修饰符则可省略关键词 <code>int</code> 。若无长度修饰符，则它保证拥有至少 16 位宽度。然而在 32/64 位系统上，几乎专门保证它拥有至少 32 位宽度（见后述）。
</dd></dl>
<h4><span class="mw-headline" id=".E4.BF.AE.E9.A5.B0.E7.AC.A6">修饰符</span></h4>
<p>修饰整数类型。能以任何顺序混合使用。类型名中每组只能有一个。
</p><p><b>符号性</b>
</p>
<dl><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">signed</span></span></span> - 目标类型将拥有有符号表示（若省略则此为默认）
</dd><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span></span></span> - 目标类型将拥有无符号表示
</dd></dl>
<p><b>大小</b>
</p>
<dl><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">short</span></span></span> - 目标类型将为空间优化，且将有至少 16 位的宽度。
</dd><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">long</span></span></span> - 目标类型将有至少 32 位的宽度。
</dd></dl>
 <table class="t-rev-begin">
<tr class="t-rev t-since-cxx11"><td>
<dl><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">long</span> <span class="kw4">long</span></span></span> - 目标类型将有至少 64 位的宽度。
</dd></dl>
</td>
<td><span class="t-mark-rev t-since-cxx11">(C++11 起)</span></td></tr>
</table>
<p>注意：与所有类型说明符相同，容许采用任何顺序： <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">long</span> <span class="kw4">long</span> <span class="kw4">int</span></span></span> 与 <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">long</span> <span class="kw4">int</span> <span class="kw4">unsigned</span> <span class="kw4">long</span></span></span> 指名同一类型。
</p>
<h4><span class="mw-headline" id=".E6.80.A7.E8.B4.A8">性质</span></h4>
<p>下表总结了所有可用的整数类型及其在各种常用数据模型中的性质：
</p>
<table class="wikitable" style="text-align:center;">

<tr>
<th rowspan="2"> 类型说明符
</th>
<th rowspan="2"> 等价类型
</th>
<th colspan="5"> 按数据模型的位宽
</th></tr>
<tr>
<th> C++ 标准
</th>
<th> LP32
</th>
<th> ILP32
</th>
<th> LLP64
</th>
<th> LP64
</th></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">short</span></span></span></div>
</td>
<td rowspan="4"> <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">short</span> <span class="kw4">int</span></span></span>
</td>
<td rowspan="6"> 至少 <b>16</b>
</td>
<td rowspan="6"> <b>16</b>
</td>
<td rowspan="6"> <b>16</b>
</td>
<td rowspan="6"> <b>16</b>
</td>
<td rowspan="6"> <b>16</b>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">short</span> <span class="kw4">int</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">signed</span> <span class="kw4">short</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">signed</span> <span class="kw4">short</span> <span class="kw4">int</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">short</span></span></span></div>
</td>
<td rowspan="2"> <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">short</span> <span class="kw4">int</span></span></span>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">short</span> <span class="kw4">int</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">int</span></span></span></div>
</td>
<td rowspan="3"> <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">int</span></span></span>
</td>
<td rowspan="5"> 至少 <b>16</b>
</td>
<td rowspan="5"> <b>16</b>
</td>
<td rowspan="5"> <b>32</b>
</td>
<td rowspan="5"> <b>32</b>
</td>
<td rowspan="5"> <b>32</b>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">signed</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">signed</span> <span class="kw4">int</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span></span></span></div>
</td>
<td rowspan="2"> <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">int</span></span></span>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">int</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">long</span></span></span></div>
</td>
<td rowspan="4"> <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">long</span> <span class="kw4">int</span></span></span>
</td>
<td rowspan="6"> 至少 <b>32</b>
</td>
<td rowspan="6"> <b>32</b>
</td>
<td rowspan="6"> <b>32</b>
</td>
<td rowspan="6"> <b>32</b>
</td>
<td rowspan="6"> <b>64</b>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">long</span> <span class="kw4">int</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">signed</span> <span class="kw4">long</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">signed</span> <span class="kw4">long</span> <span class="kw4">int</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">long</span></span></span></div>
</td>
<td rowspan="2"> <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">long</span> <span class="kw4">int</span></span></span>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">long</span> <span class="kw4">int</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">long</span> <span class="kw4">long</span></span></span></div>
</td>
<td rowspan="4"> <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">long</span> <span class="kw4">long</span> <span class="kw4">int</span></span></span> <br> <span class="t-mark-rev t-since-cxx11">(C++11)</span>
</td>
<td rowspan="6"> 至少 <b>64</b>
</td>
<td rowspan="6"> <b>64</b>
</td>
<td rowspan="6"> <b>64</b>
</td>
<td rowspan="6"> <b>64</b>
</td>
<td rowspan="6"> <b>64</b>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">long</span> <span class="kw4">long</span> <span class="kw4">int</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">signed</span> <span class="kw4">long</span> <span class="kw4">long</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">signed</span> <span class="kw4">long</span> <span class="kw4">long</span> <span class="kw4">int</span></span></span></div>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">long</span> <span class="kw4">long</span></span></span></div>
</td>
<td rowspan="2"> <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">long</span> <span class="kw4">long</span> <span class="kw4">int</span></span></span> <br> <span class="t-mark-rev t-since-cxx11">(C++11)</span>
</td></tr>
<tr>
<td> <div style="text-align:left; width:auto; margin-left:auto; margin-right:auto;"><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">long</span> <span class="kw4">long</span> <span class="kw4">int</span></span></span></div>
</td></tr></table>
<p>注意：整数算术对有符号和无符号整数类型的定义是不同的。见<a href="operator_arithmetic.html" title="cpp/language/operator arithmetic">算术运算符</a>，特别是<a href="operator_arithmetic.html#.E6.BA.A2.E5.87.BA" title="cpp/language/operator arithmetic">整数溢出</a>。
</p><p><span class="t-c"><span class="mw-geshi cpp source-cpp"><a href="../types/size_t.html"><span class="kw100">std::<span class="me2">size_t</span></span></a></span></span> 是 <span class="t-c"><span class="mw-geshi cpp source-cpp">sizeof</span></span> 运算符<span class="t-rev-inl t-since-cxx11"><span>还有 <span class="t-c"><span class="mw-geshi cpp source-cpp">sizeof...</span></span> 运算符及 <span class="t-c"><span class="mw-geshi cpp source-cpp">alignof</span></span> 运算符</span> <span><span class="t-mark-rev t-since-cxx11">(C++11 起)</span></span></span>的结果的无符号整数类型。
</p><p><span class="t-rev-inl t-since-cxx11"><span>参阅<a href="../types/integer.html" title="cpp/types/integer">定宽整数类型</a>。</span> <span><span class="t-mark-rev t-since-cxx11">(C++11 起)</span></span></span>
</p>
<h4><span class="mw-headline" id=".E6.95.B0.E6.8D.AE.E6.A8.A1.E5.9E.8B">数据模型</span></h4>
<p>每个实现关于基础类型大小所做的选择被统称为<i>数据模型</i>。有四个数据模型广为接受：
</p><p>32 位系统：
</p>
<dl><dd><ul><li><b>LP32</b> 或 <b>2/4/4</b> （ int 为 16 位， long 和指针为 32 位）
</li></ul>
<dl><dd><ul><li> Win16 API
</li></ul>
</dd></dl>
<ul><li><b>ILP32</b> 或 <b>4/4/4</b> （ int 、 long 和指针为 32 位）
</li></ul>
<dl><dd><ul><li> Win32 API
</li><li> Unix 和类 Unix 系统（ Linux 、 Mac OS X ）
</li></ul>
</dd></dl>
</dd></dl>
<p>64 位系统：
</p>
<dl><dd><ul><li> <b>LLP64</b> 或 <b>4/4/8</b> （ int 和 long 为 32 位，指针为 64 位）
</li></ul>
<dl><dd><ul><li> Win64 API
</li></ul>
</dd></dl>
<ul><li> <b>LP64</b> 或 <b>4/8/8</b> （ int 为 32 位， long 和指针为 64 位）
</li></ul>
<dl><dd><ul><li> Unix 和类 Unix 系统（ Linux 、 Mac OS X ）
</li></ul>
</dd></dl>
</dd></dl>
<p>其他数据模型很罕见。例如， <b>ILP64</b> （ <b>8/8/8</b> ： int 、 long 和指针为 64 位）只出现于某些早期 64 位 Unix 系统（例如 Unicos on Cray ）。
</p>
<h3><span class="mw-headline" id=".E5.AD.97.E7.AC.A6.E7.B1.BB.E5.9E.8B">字符类型</span></h3>
<dl><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">signed</span> <span class="kw4">char</span></span></span> - 有符号字符表示的类型。
</dd><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">char</span></span></span> - 无符号字符表示的类型。亦用于审查<a href="object.html" title="cpp/language/object">对象表示</a>（无修饰内存）。
</dd><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">char</span></span></span> - 能在目标系统上最有效地处理的字符表示的类型（拥有与 <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">signed</span> <span class="kw4">char</span></span></span> 或 <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">char</span></span></span> 之一相同的表示和对齐，但始终是独立的类型）。<a href="../string/multibyte.html" title="cpp/string/multibyte">多字节字符串</a>用此类型表示编码单元。<span class="t-rev-inl t-since-cxx14"><span>各字符类型均大到足够表示任何 UTF-8 的八位编码单元。</span> <span><span class="t-mark-rev t-since-cxx14">(C++14 起)</span></span></span> <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">char</span></span></span> 的符号性取决于编译器和目标平台： ARM 和 PowerPC 的默认设置常为无符号，而 x86 与 x64 的默认设置常为有符号。
</dd><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">wchar_t</span></span></span> - 宽字符表示的类型（见<a href="../string/wide.html" title="cpp/string/wide">宽字符串</a>）。要求大到足以表示任何受支持的字符编码位点（支持 Unicode 的系统上为 32 位。值得注意的例外是 Windows，其中 wchar_t 为 16 位并保有 UTF-16 编码单元）。它与整数类型之一具有相同的大小、符号性和对齐，但它是独立的类型。
</dd></dl>
 <table class="t-rev-begin">
<tr class="t-rev t-since-cxx11"><td>
<dl><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">char16_t</span></span></span> - UTF-16 字符表示的类型，要求大到足以表示任何 UTF-16 编码单元（ 16 位）。它与 <span class="t-lc"><a href="../types/integer.html" title="cpp/types/integer">std::uint_least16_t</a></span> 具有相同的大小、符号性和对齐，但它是独立的类型。
</dd><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">char32_t</span></span></span> - UTF-32 字符表示的类型，要求大到足以表示任何 UTF-32 编码单元（ 32 位）。它与 <span class="t-lc"><a href="../types/integer.html" title="cpp/types/integer">std::uint_least32_t</a></span> 具有相同的大小、符号性和对齐，但它是独立的类型。
</dd></dl>
</td>
<td><span class="t-mark-rev t-since-cxx11">(C++11 起)</span></td></tr>
<tr class="t-rev t-since-cxx20"><td>
<dl><dd><span class="t-c"><span class="mw-geshi cpp source-cpp">char8_t</span></span> - UTF-8 字符表示的类型，要求大到足以表示任何 UTF-8 编码单元（ 8 位）。它与 <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">unsigned</span> <span class="kw4">char</span></span></span> 具有相同的大小、符号性和对齐（从而与 <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">char</span></span></span> 和 <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">signed</span> <span class="kw4">char</span></span></span> 具有相同的大小和对齐），但它是独立的类型。
</dd></dl>
</td>
<td><span class="t-mark-rev t-since-cxx20">(C++20 起)</span></td></tr>
</table>
<p>除了最小位数， C++ 标准还保证
</p>
<dl><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="nu0">1</span> <span class="sy1">==</span> sizeof<span class="br0">(</span><span class="kw4">char</span><span class="br0">)</span> <span class="sy1">&lt;=</span> sizeof<span class="br0">(</span><span class="kw4">short</span><span class="br0">)</span> <span class="sy1">&lt;=</span> sizeof<span class="br0">(</span><span class="kw4">int</span><span class="br0">)</span> <span class="sy1">&lt;=</span> sizeof<span class="br0">(</span><span class="kw4">long</span><span class="br0">)</span> <span class="sy1">&lt;=</span> sizeof<span class="br0">(</span><span class="kw4">long</span> <span class="kw4">long</span><span class="br0">)</span></span></span> 。
</dd></dl>
<p>注意：这允许一种极端情况，其中<a href="https://en.wikipedia.org/wiki/Byte" class="extiw" title="enwiki:Byte">字节</a>有 64 位大小，所有类型（包括 <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">char</span></span></span> ）都有 64 位宽，而 <span class="t-c"><span class="mw-geshi cpp source-cpp">sizeof</span></span> 对每个类型均返回 1。
</p>
<h3><span class="mw-headline" id=".E6.B5.AE.E7.82.B9.E7.B1.BB.E5.9E.8B">浮点类型</span></h3>
<dl><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">float</span></span></span> - 单精度浮点类型。通常为 IEEE-754 32 位浮点类型
</dd></dl>
<dl><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">double</span></span></span> - 双精度浮点类型。通常为 IEEE-754 64 位浮点类型
</dd></dl>
<dl><dd><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">long</span> <span class="kw4">double</span></span></span> - 扩展精度浮点类型。不必映射到 IEEE-754 所强制的类型。在 x86 和 x86-64 架构上通常为 80 位 x87 浮点类型。
</dd></dl>
<h4><span class="mw-headline" id=".E6.80.A7.E8.B4.A8_2">性质</span></h4>
<p>浮点类型支持一些<a href="../types/numeric_limits.html" title="cpp/types/numeric limits">特殊值</a>：
</p>
<ul><li> <i>无穷</i>（正和负），见 <span class="t-lc"><a href="../numeric/math/INFINITY.html" title="cpp/numeric/math/INFINITY">INFINITY</a></span>
</li><li> <i>负零</i>， <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="sy2">-</span><span class="nu16">0.0</span></span></span> 。它与正零比较相等，但在某些算术运算中有意义，例如 <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="nu16">1.0</span><span class="sy2">/</span><span class="nu16">0.0</span> <span class="sy1">==</span> <a href="../numeric/math/INFINITY.html"><span class="kw1377">INFINITY</span></a></span></span> ，但 <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="nu16">1.0</span><span class="sy2">/-</span><span class="nu16">0.0</span> <span class="sy1">==</span> <span class="sy2">-</span><a href="../numeric/math/INFINITY.html"><span class="kw1377">INFINITY</span></a></span></span>) ，而且对某些数学函数有意义，例如 <a href="../numeric/complex/sqrt.html" title="cpp/numeric/complex/sqrt"><tt>sqrt<span style="font-size:0.7em; line-height:130%">(std::complex)</span></tt></a>
</li><li> <i>非数</i> (NaN) ，它与任何值（包括自身）比较都不相等。多个位模式都表示 NaN ，见 <span class="t-lc"><a href="../numeric/math/nan.html" title="cpp/numeric/math/nan">std::nan</a></span> 、 <span class="t-lc"><a href="../numeric/math/NAN.html" title="cpp/numeric/math/NAN">NAN</a></span> 。注意 C++ 并不对发信 NaN 进行特殊对待，把所有 NaN 均当做静默 NaN，但提供了 <span class="t-lc"><a href="../types/numeric_limits/has_signaling_NaN.html" title="cpp/types/numeric limits/has signaling NaN">std::numeric_limits::has_signaling_NaN</a></span> 用以检测它们的支持情况。
</li></ul>
<p>实浮点数可用于<a href="operator_arithmetic.html" title="cpp/language/operator arithmetic">算术运算符</a> + - / * 和各种来自 <a href="../header/cmath.html" title="cpp/header/cmath"><tt>&lt;cmath&gt;</tt></a> 的数学函数。内建运算符和库函数都可能引发浮点异常，并按 <a href="../numeric/math/math_errhandling.html" title="cpp/numeric/math/math errhandling"><tt>math_errhandling</tt></a> 中的描述设置 <span class="t-lc"><a href="../error/errno.html" title="cpp/error/errno">errno</a></span> 。
</p><p>浮点表达式可拥有大于其类型所指定的值域和精度，见 <span class="t-lc"><a href="../types/climits/FLT_EVAL_METHOD.html" title="cpp/types/climits/FLT EVAL METHOD">FLT_EVAL_METHOD</a></span> 。浮点表达式亦可<i>收缩（contract）</i>，即如同所有中间值拥有无限范围和精度一般求值，见 <a href="../preprocessor/impl.html#.23pragma_STDC" title="cpp/preprocessor/impl">#pragma STDC FP_CONTRACT</a> 。
</p><p>浮点数上的某些运算受<a href="../numeric/fenv.html" title="cpp/numeric/fenv">浮点环境</a>的状态影响，并对其进行修改（最值得注意的是舍入方向）。
</p><p>在实浮点类型和整数类型间定义了<a href="implicit_cast.html" title="cpp/language/implicit conversion">隐式转换</a>。
</p><p>浮点类型的其他细节、界限和性质见<a href="../types/climits.html#.E6.B5.AE.E7.82.B9.E7.B1.BB.E5.9E.8B.E7.9A.84.E7.95.8C.E9.99.90" title="cpp/types/climits">浮点类型的界限</a>和 <a href="../types/numeric_limits.html" title="cpp/types/numeric limits"><tt>std::numeric_limits</tt></a> 。
</p>
<h3><span class="mw-headline" id=".E5.8F.96.E5.80.BC.E8.8C.83.E5.9B.B4">取值范围</span></h3>
<p>下表提供常用数值表示的界限的参考。
</p><p>C++20 之前，C++ 标准曾允许任意的有符号整数表示，而 N 位有符号整数的最小保证范围为从 <span class="texhtml" style="white-space: nowrap;">-2<span class="t-su">N-1<br></span>+1</span> 到 <span class="texhtml" style="white-space: nowrap;">+2<span class="t-su">N-1<br></span>-1</span> （例如有符号 8 位类型为 <b>-127</b> 到 <b>127</b> ），这对应于<a href="https://en.wikipedia.org/wiki/One%27s_complement" class="extiw" title="enwiki:One's complement">反码</a>或<a href="https://en.wikipedia.org/wiki/Signed_number_representations#Sign-and-magnitude_method" class="extiw" title="enwiki:Signed number representations">原码</a>的界限。
</p><p>然而，所有 C++ 编译器均使用<a href="https://en.wikipedia.org/wiki/Two%27s_complement" class="extiw" title="enwiki:Two's complement">补码</a>表示，而从 C++20 起，这是标准所允许的唯一表示，所保证的范围为从 <span class="texhtml" style="white-space: nowrap;">-2<span class="t-su">N-1<br></span></span> 到 <span class="texhtml" style="white-space: nowrap;">+2<span class="t-su">N-1<br></span>-1</span> （例如有符号 8 位类型为 <b>-128</b> 到 <b>127</b> ）。
</p>
<table class="wikitable" style="text-align:center;">

<tr>
<th rowspan="2"> 类型
</th>
<th rowspan="2"> 位数
</th>
<th rowspan="2"> 格式
</th>
<th colspan="2"> 取值范围
</th></tr>
<tr>
<th> 近似
</th>
<th> 精确
</th></tr>
<tr>
<th rowspan="4"> 字符
</th>
<td rowspan="2"> 8
</td>
<td> 有符号
</td>
<td>
</td>
<td> <b>-128</b> 到 <b>127</b>
</td></tr>
<tr>
<td> 无符号
</td>
<td>
</td>
<td> <b>0</b> 到 <b>255</b>
</td></tr>

<tr>
<td> 16
</td>
<td> 无符号
</td>
<td>
</td>
<td> <b>0</b> 到 <b>65535</b>
</td></tr>

<tr>
<td> 32
</td>
<td> 无符号
</td>
<td>
</td>
<td> <b>0</b> 到 <b>1114111</b> (<b>0x10ffff</b>)
</td></tr>

<tr>
<th rowspan="6"> 整数
</th>
<td rowspan="2"> 16
</td>
<td> 有符号
</td>
<td> <b>± 3.27 · 10<sup>4</sup></b>
</td>
<td> <b>-32768</b> 到 <b>32767</b>
</td></tr>
<tr>
<td> 无符号
</td>
<td> <b>0</b> 到 <b>6.55 · 10<sup>4</sup></b>
</td>
<td> <b>0</b> 到 <b>65535</b>
</td></tr>
<tr>
<td rowspan="2"> 32
</td>
<td> 有符号
</td>
<td> <b>± 2.14 · 10<sup>9</sup></b>
</td>
<td> <b>-2,147,483,648</b> 到 <b>2,147,483,647</b>
</td></tr>
<tr>
<td> 无符号
</td>
<td> <b>0</b> 到 <b>4.29 · 10<sup>9</sup></b>
</td>
<td> <b>0</b> 到 <b>4,294,967,295</b>
</td></tr>
<tr>
<td rowspan="2"> 64
</td>
<td> 有符号
</td>
<td> <b>± 9.22 · 10<sup>18</sup></b>
</td>
<td> <b>-9,223,372,036,854,775,808</b> 到 <b>9,223,372,036,854,775,807</b>
</td></tr>
<tr>
<td> 无符号
</td>
<td> <b>0</b> 到 <b>1.84 · 10<sup>19</sup></b>
</td>
<td> <b>0</b> 到 <b>18,446,744,073,709,551,615</b>
</td></tr>
<tr>
<th rowspan="2"> 浮点
</th>
<td> 32
</td>
<td> <a href="https://en.wikipedia.org/wiki/IEEE-754" class="extiw" title="enwiki:IEEE-754">IEEE-754</a>
</td>
<td><div>
<ul><li>最小非正规：<br><b>± 1.401,298,4 · 10<sup>-45</sup></b>
</li><li>最小正规：<br><b>± 1.175,494,3 · 10<sup>-38</sup></b>
</li><li>最大：<br><b>± 3.402,823,4 · 10<sup>38</sup></b>
</li></ul>
</div>
</td>
<td><div>
<ul><li>最小非正规：<br><b>±0x1p-149</b>
</li><li>最小正规：<br><b>±0x1p-126</b>
</li><li>最大：<br><b>±0x1.fffffep+127</b>
</li></ul>
</div>
</td></tr>
<tr>
<td> 64
</td>
<td> <a href="https://en.wikipedia.org/wiki/IEEE-754" class="extiw" title="enwiki:IEEE-754">IEEE-754</a>
</td>
<td> <div>
<ul><li>最小非正规：<br><b>± 4.940,656,458,412 · 10<sup>-324</sup></b>
</li><li>最小正规：<br><b>± 2.225,073,858,507,201,4 · 10<sup>-308</sup></b>
</li><li>最大：<br><b>± 1.797,693,134,862,315,7 · 10<sup>308</sup></b>
</li></ul>
</div>
</td>
<td> <div>
<ul><li>最小非正规：<br><b>±0x1p-1074</b>
</li><li>最小正规：<br><b>±0x1p-1022</b>
</li><li>最大：<br><b>±0x1.fffffffffffffp+1023</b>
</li></ul>
</div>
</td></tr></table>
<p><br>
注意：这些类型可表示的值的实际界限（与保证的最小界限相对）可通过 <a href="../header/climits.html" title="cpp/header/climits"><tt>&lt;climits&gt;</tt></a> 、 <a href="../header/cfloat.html" title="cpp/header/cfloat"><tt>&lt;cfloat&gt;</tt></a> 及 <span class="t-lc"><a href="../types/numeric_limits.html" title="cpp/types/numeric limits">std::numeric_limits</a></span> 获知。
</p>
<h3><span class="mw-headline" id=".E5.85.B3.E9.94.AE.E8.AF.8D">关键词</span></h3>
<p><a href="../keyword/void.html" title="cpp/keyword/void"><tt>void</tt></a>, 
<a href="../keyword/bool.html" title="cpp/keyword/bool"><tt>bool</tt></a>, 
<a href="../keyword/true.html" title="cpp/keyword/true"><tt>true</tt></a>, 
<a href="../keyword/false.html" title="cpp/keyword/false"><tt>false</tt></a>, 
<a href="../keyword/char.html" title="cpp/keyword/char"><tt>char</tt></a>,
<a href="../keyword/wchar_t.html" title="cpp/keyword/wchar t"><tt>wchar_t</tt></a>,
<a href="../keyword/char8_t.html" title="cpp/keyword/char8 t"><tt>char8_t</tt></a>,
<a href="../keyword/char16_t.html" title="cpp/keyword/char16 t"><tt>char16_t</tt></a>,
<a href="../keyword/char32_t.html" title="cpp/keyword/char32 t"><tt>char32_t</tt></a>,
<a href="../keyword/int.html" title="cpp/keyword/int"><tt>int</tt></a>,
<a href="../keyword/short.html" title="cpp/keyword/short"><tt>short</tt></a>,
<a href="../keyword/long.html" title="cpp/keyword/long"><tt>long</tt></a>,
<a href="../keyword/signed.html" title="cpp/keyword/signed"><tt>signed</tt></a>,
<a href="../keyword/unsigned.html" title="cpp/keyword/unsigned"><tt>unsigned</tt></a>,
<a href="../keyword/float.html" title="cpp/keyword/float"><tt>float</tt></a>,
<a href="../keyword/double.html" title="cpp/keyword/double"><tt>double</tt></a>
</p>
<h3><span class="mw-headline" id=".E5.8F.82.E9.98.85">参阅</span></h3>
<ul><li> <a href="incomplete_type.html" title="cpp/language/type"> C++ 类型系统概览</a> 
</li><li> <a href="cv.html" title="cpp/language/cv"> const-volatile (cv) 说明符与限定符</a>
</li><li> <a href="storage_duration.html" title="cpp/language/storage duration"> 存储期说明符</a>
</li></ul>
<table class="t-dsc-begin">

</table>

<!-- 
NewPP limit report
Preprocessor visited node count: 4077/1000000
Preprocessor generated node count: 8426/1000000
Post‐expand include size: 53922/2097152 bytes
Template argument size: 11664/2097152 bytes
Highest expansion depth: 13/40
Expensive parser function count: 0/100
-->

<!-- Saved in parser cache with key mwiki1-mwiki_zh_:pcache:idhash:902-0!*!0!!zh!*!zh!* and timestamp 20200113012027 -->
</div>                    <!-- /bodycontent -->
                                        <!-- printfooter -->
                    <div class="printfooter">
                    来自“<a href="https://zh.cppreference.com/mwiki/index.php?title=cpp/language/types&amp;oldid=62663">https://zh.cppreference.com/mwiki/index.php?title=cpp/language/types&amp;oldid=62663</a>”                    </div>
                    <!-- /printfooter -->
                                                            <!-- catlinks -->
                    <!-- /catlinks -->
                                                            <div class="visualClear"></div>
                    <!-- debughtml -->
                                        <!-- /debughtml -->
                </div>
                <!-- /bodyContent -->
            </div>
        </div>
        <!-- /content -->
        <!-- footer -->
        <div id="cpp-footer-base" class="noprint">
            <div id="footer">
                        <div id="cpp-navigation">
            <h5>导航</h5>
            <ul><li><a href="https://zh.cppreference.com/w/cpp/language/types">Online version</a></li><li>Offline version retrieved 2020-03-14 18:00.</li></ul></div>
                        <ul id="footer-info">
                                    <li id="footer-info-lastmod"> 本页面最后修改于2019年9月6日 (星期五) 18:10。</li>
                                    <li id="footer-info-viewcount">此页面已被浏览过52,504次。</li>
                            </ul>
                    </div>
        </div>
        <!-- /footer -->
        <script>if(window.mw){
mw.loader.state({"site":"loading","user":"missing","user.groups":"ready"});
}</script>
<script src="../../../common/skin_scripts.js"></script>
<script>if(window.mw){
mw.loader.load(["mediawiki.action.view.postEdit","mediawiki.user","mediawiki.page.ready","mediawiki.searchSuggest","mediawiki.hidpi","ext.gadget.MathJax","ext.gadget.ColiruCompiler"], null, true);
}</script>
<script src="../../../common/site_scripts.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2828341-1']);
_gaq.push(['_setDomainName', 'cppreference.com']);
_gaq.push(['_trackPageview']);
</script><!-- Served in 4.001 secs. -->
	</body>
<!-- Cached 20200113012027 -->
</html>